/*******************************************************************\
| Object.h
|
| CREATED:		23.3.2009
| DESCRIPTION:
| 
| Base class for objects in a scene
\********************************************************************/
#ifndef OBJECT_H
#define OBJECT_H

namespace PhotonMapping
{


//*****************************************************************************
// class overview:
//   Abstract object base class
//-----------------------------------------------------------------------------
class IObject
{
	public:
		IObject(intx p_MaterialId)
			: m_MaterialId(p_MaterialId)
		{ }

	public:

		// Returns true if p_Ray intersects the given object within the specified distance p_Distance
		// The distance between the ray's origin and the intersection point will be written to p_Distance
		virtual intx TestIntersection(const Math::Ray& p_Ray, float &p_Distance) = 0;

		virtual const Math::Sphere& GetBoundingSphere() const = 0;

		// return the surface normal for the given point
		virtual const Math::Vector3 GetNormalAt(const Math::Vector3& p_Pos) = 0;

		intx GetMaterial() const { return m_MaterialId; }

	public:

		// consts for intersection tests
		static const intx HIT = 1;
		static const intx MISS = 0;
		static const intx INPRIM = -1;

	private:
		intx m_MaterialId;
	
};

// define pointer type
typedef std::tr1::shared_ptr<IObject> ObjectPtr;

}

#endif // OBJECT_H
